<script setup lang="ts">

import {useRoute, useRouter} from "vue-router";

// 使用路由
let route = useRoute();

// 路由器
let router = useRouter();


function getInfo() {
  // 获取路由信息
  console.log("route", route);
  // 获取路由路径参数
  console.log("params", route.params);
  // 组件名
  console.log("name", route.name);
  // 路径
  console.log("path", route.path);
}

function goHome() {
  // 跳转到首页
  router.push('/')
}

function back() {
  // 回退
  router.go(-1)
}

</script>

<template>
<h3>个人详情</h3>

  <button @click="getInfo">页面信息</button>

  <button @click="goHome">跳到首页</button>

  <button @click="back">回退</button>
</template>

<style scoped>

</style>